<%--
  Created by IntelliJ IDEA.
  User: ASUS
  Date: 2020/12/8
  Time: 20:06
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page isELIgnored="false" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <title>科室列表</title>
</head>

<body>
<h1 class="text-center pt-3 pb-3">科室列表</h1>

<div class="container">
    <div class="offset-md-3 col-md-6">
        <div class="row">
            <div class="col-md-2">
                <form action="/goto_add.action" class="form-inline">
                    <div class="form-group">
                        <button type="submit" onclick="search()" class="btn btn-link">新增科室</button>
                    </div>
                </form>
            </div>
        </div>

        <table class="table table-bordered">
            <thead>
            <tr>
                <th>编号</th>
                <th>名称</th>
                <th>人数</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            <c:forEach items="${departmentPage.departmentList}" var="i">
                <tr>
                    <td class="text-center disabled">
                        <input type="checkbox" class="form-check-input" name="did" value="${i.did}">
                    </td>
                    <td>${i.did}</td>
                    <td>${i.dname}</td>
                    <td>${i.num}</td>
                    <td>
                        <a href="#">修改</a>
                        <a href="#">删除</a>
                    </td>
                </tr>
            </c:forEach>

            </tbody>
        </table>

        <nav class="pb-5 pt-3">
            <ul class="pagination justify-content-center">
                <c:if test="${departmentPage.pageNum==1}">
                    <li class="page-item disabled">
                        <a class="page-link" href="#"  tabindex="-1">首页</a>
                    </li>
                </c:if>

                <c:if test="${departmentPage.pageNum!=1}">
                    <li class="page-item ">
                        <a class="page-link" href="/all_departments.action?page=1"  tabindex="-1">首页</a>
                    </li>
                </c:if>

                <c:forEach begin="1" end="${departmentPage.pageCount}" var="d">
                    <c:if test="${departmentPage.pageNum == d}">
                        <li class="page-item disabled"><a class="page-link" href="#"> ${d}</a></li>
                    </c:if>
                    <c:if test="${departmentPage.pageNum != d}">
                        <li class="page-item active"><a class="page-link" href="/all_departments.action?page=${d}">${d}</a></li>
                    </c:if>
                </c:forEach>

                <c:if test="${departmentPage.pageNum==departmentPage.pageCount}">
                    <li class="page-item disabled">
                        <a class="page-link" href="#">末页</a>
                    </li>
                </c:if>

                <c:if test="${departmentPage.pageNum!=departmentPage.pageCount}">

                    <li class="page-item">
                        <a class="page-link" href="/all_departments.action?page=${departmentPage.pageCount}">末页</a>
                    </li>

                </c:if>

            </ul>
        </nav>
    </div>
</div>
</body>
</html>